﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Com.Framework;
using Com.Framework.Data;
using Com.Web.coffinegurunaru.AppLogic.Page;
using Com.Library.DB.Store;

namespace Com.Web.coffinegurunaru.store
{
	public partial class store_view : WebPage
	{
		public int PageNo { get; set; }
		public int StoreNo { get; set; }
		public string CityName { get; set; }
		public string StoreName { get; set; }

		public StoreEntity StoreInfo
		{
			get;
			set;
		}

		public List<StoreEntity> StoreList
		{
			get;
			set;
		}

		public List<StoreImageEntity> StoreImageList
		{
			get;
			set;
		}

		protected void Page_Load(object sender, EventArgs e)
		{
			this.LeftMenuType = 2;
			PageNo = Request.QueryString["PageNo"].Parse(0);
			StoreNo = Request.QueryString["StoreNo"].Parse(0);
			CityName = Request.QueryString["CityName"].Parse(string.Empty);
			StoreName = Request.QueryString["StoreName"].Parse(string.Empty);

			if (StoreNo == 0)
			{
				Response.Clear();
				Response.Write("<script language='javascript'>alert('매장 번호가 없습니다.'); location.href='/store/search_store.aspx';</script>");
				Response.End();
			}


			StoreInfo = StoreModel.GetInfo(StoreNo);
			if (StoreInfo.CreateDate == DateTime.MinValue)
			{
				Response.Clear();
				Response.Write("<script language='javascript'>alert('존재하지 않는 매장입니다.'); location.href='/store/search_store.aspx';</script>");
				Response.End();
			}
			else
			{
				StoreList = StoreModel.GetList("Y", 1, 30).Record;
				StoreImageList = StoreModel.ImageGetList(StoreInfo.StoreNo, 5);
			}
		}
	}
}
